package com.umeox.watch.audiobooks.db

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query

/**
 * Created by Rambo 2021/8/18
 * Describe:
 */
@Dao
interface RecommendStoryDao {

    @Query("SELECT * FROM recommend_story")
    fun loadAll(): List<RecommendStory>?

    @Query("SELECT * FROM recommend_story WHERE id =:id")
    fun queryById(id: Long): RecommendStory?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun save(recommendStory: RecommendStory)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun save(recommendStories: List<RecommendStory>)

    @Delete
    fun delete(recommendStory: RecommendStory): Int

    @Delete
    fun delete(recommendStories: List<RecommendStory>)

    @Query("DELETE FROM recommend_story")
    fun deleteAll(): Int
}